<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        #box {
            width: 200px;
            height: 200px;
            border: 1px solid #333;
            padding: 5px;
            background-color: #6ff;
            margin: 50px;
        }
    </style>
</head>

<body>
    <!-- <input type="text"> -->
    <!-- <div id="box" style="width:400px;height:400px"> -->
    <div id="box">
        <span>111111</span>
    </div>
</body>
<script>
    // 1. JS操作元素之前必须先获取元素
    // 2. 获取和设置非表单元素的内容  innerText  innerHTML
    // 3. JS操作元素改变样式时,都是通过内联样式实现的



    // innerText  获取和设置元素内的文本
    // innerHTML  获取和设置元素内的html结构(html + text)

    var box = document.getElementById("box");

    box.onclick = function () {
        // console.log(box.innerText);
        // box.innerText = "22222";  //能操作元素的只有元素本身


        // console.log(box.innerHTML);
        // box.innerHTML = "<h2>22222</h2>"

        box.style.width = "400px";
        box.style.height = "400px";
        box.style.backgroundColor = "red";

    }






</script>

</html>